/* dt.h - descriptor structures */

#ifndef		_DT_H_
#define		_DT_H_

#include	"common.h"

#define		GDT_EMAX	5
#define		IDT_EMAX	256

struct gdt_entry{
	u16int limit_low;
	u16int base_low;
	u8int  base_middle;
	u8int  access;
	u8int  gran;
	u8int  base_high;
} __attribute__((packed));

struct gdt_ptr{
	u16int limit;
	u32int base;
} __attribute__((packed));

struct idt_entry{
    u16int base_lo;
    u16int sel;
    u8int  always0;
    u8int  flags;
    u16int base_hi;
} __attribute__((packed));

struct idt_ptr{
    u16int limit;
    u32int base;
} __attribute__((packed));

struct tss_entry{
	u32int prev_tss;
	u32int esp0;
	u32int ss0;
	u32int esp1;
	u32int ss1;
	u32int esp2;
	u32int ss2;
	u32int cr3;
	u32int eip;
	u32int eflags;
	u32int eax;
	u32int ecx;
	u32int edx;
	u32int ebx;
	u32int esp;
	u32int ebp;
	u32int esi;
	u32int edi;
	u32int es;
	u32int cs;
	u32int ss;
	u32int ds;
	u32int fs;
	u32int gs;
	u32int ldt;
	u16int trap;
	u16int iomap_base;
} __attribute__((packed));

void init_dt();
void set_kernel_stack(u32int stack);

extern void isr0 ();
extern void isr1 ();
extern void isr2 ();
extern void isr3 ();
extern void isr4 ();
extern void isr5 ();
extern void isr6 ();
extern void isr7 ();
extern void isr8 ();
extern void isr9 ();
extern void isr10();
extern void isr11();
extern void isr12();
extern void isr13();
extern void isr14();
extern void isr15();
extern void isr16();
extern void isr17();
extern void isr18();
extern void isr19();
extern void isr20();
extern void isr21();
extern void isr22();
extern void isr23();
extern void isr24();
extern void isr25();
extern void isr26();
extern void isr27();
extern void isr28();
extern void isr29();
extern void isr30();
extern void isr31();

extern void irq0();
extern void irq1();
extern void irq2();
extern void irq3();
extern void irq4();
extern void irq5();
extern void irq6();
extern void irq7();
extern void irq8();
extern void irq9();
extern void irq10();
extern void irq11();
extern void irq12();
extern void irq13();
extern void irq14();
extern void irq15();

extern void isr128();		/* system call */


#endif
